3.1.60 \(\int (c+d x) (a+b \tanh (e+f x))^2 \, dx\) [60]

Optimal. Leaf size=127 \[ b^2 c x+\frac {1}{2} b^2 d x^2+\frac {a^2 (c+d x)^2}{2 d}-\frac {a b (c+d x)^2}{d}+\frac {2 a b (c+d x) \log \left (1+e^{2 (e+f x)}\right )}{f}+\frac {b^2 d \log (\cosh (e+f x))}{f^2}+\frac {a b d \text {PolyLog}\left (2,-e^{2 (e+f x)}\right )}{f^2}-\frac {b^2 (c+d x) \tanh (e+f x)}{f} \]

[Out]

b^2*c*x+1/2*b^2*d*x^2+1/2*a^2*(d*x+c)^2/d-a*b*(d*x+c)^2/d+2*a*b*(d*x+c)*ln(1+exp(2*f*x+2*e))/f+b^2*d*ln(cosh(f
*x+e))/f^2+a*b*d*polylog(2,-exp(2*f*x+2*e))/f^2-b^2*(d*x+c)*tanh(f*x+e)/f

________________________________________________________________________________________

Rubi [A]
time = 0.13, antiderivative size = 127, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 7, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.389, Rules used = {3803, 3799, 2221, 2317, 2438, 3801, 3556} \begin {gather*} \frac {a^2 (c+d x)^2}{2 d}+\frac {2 a b (c+d x) \log \left (e^{2 (e+f x)}+1\right )}{f}-\frac {a b (c+d x)^2}{d}+\frac {a b d \text {Li}_2\left (-e^{2 (e+f x)}\right )}{f^2}-\frac {b^2 (c+d x) \tanh (e+f x)}{f}+b^2 c x+\frac {b^2 d \log (\cosh (e+f x))}{f^2}+\frac {1}{2} b^2 d x^2 \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*x)*(a + b*Tanh[e + f*x])^2,x]

[Out]

b^2*c*x + (b^2*d*x^2)/2 + (a^2*(c + d*x)^2)/(2*d) - (a*b*(c + d*x)^2)/d + (2*a*b*(c + d*x)*Log[1 + E^(2*(e + f
*x))])/f + (b^2*d*Log[Cosh[e + f*x]])/f^2 + (a*b*d*PolyLog[2, -E^(2*(e + f*x))])/f^2 - (b^2*(c + d*x)*Tanh[e +
 f*x])/f

Rule 2221

Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/((a_) + (b_.)*((F_)^((g_.)*((e_.) +
 (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp[((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x]
 - Dist[d*(m/(b*f*g*n*Log[F])), Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x], x] /; FreeQ[{F,
a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]

Rule 2317

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[1/(d*e*n*Log[F]), Subst[Int
[Log[a + b*x]/x, x], x, (F^(e*(c + d*x)))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]

Rule 2438

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2, (-c)*e*x^n]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3799

Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + (Complex[0, fz_])*(f_.)*(x_)], x_Symbol] :> Simp[(-I)*((c + d*x)^(m
 + 1)/(d*(m + 1))), x] + Dist[2*I, Int[(c + d*x)^m*(E^(2*((-I)*e + f*fz*x))/(1 + E^(2*((-I)*e + f*fz*x)))), x]
, x] /; FreeQ[{c, d, e, f, fz}, x] && IGtQ[m, 0]

Rule 3801

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(c + d*x)^m*((b*Tan[e
 + f*x])^(n - 1)/(f*(n - 1))), x] + (-Dist[b*d*(m/(f*(n - 1))), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rule 3803

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[ExpandIntegrand[
(c + d*x)^m, (a + b*Tan[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[m, 0] && IGtQ[n, 0]

Rubi steps

\begin {align*} \int (c+d x) (a+b \tanh (e+f x))^2 \, dx &=\int \left (a^2 (c+d x)+2 a b (c+d x) \tanh (e+f x)+b^2 (c+d x) \tanh ^2(e+f x)\right ) \, dx\\ &=\frac {a^2 (c+d x)^2}{2 d}+(2 a b) \int (c+d x) \tanh (e+f x) \, dx+b^2 \int (c+d x) \tanh ^2(e+f x) \, dx\\ &=\frac {a^2 (c+d x)^2}{2 d}-\frac {a b (c+d x)^2}{d}-\frac {b^2 (c+d x) \tanh (e+f x)}{f}+(4 a b) \int \frac {e^{2 (e+f x)} (c+d x)}{1+e^{2 (e+f x)}} \, dx+b^2 \int (c+d x) \, dx+\frac {\left (b^2 d\right ) \int \tanh (e+f x) \, dx}{f}\\ &=b^2 c x+\frac {1}{2} b^2 d x^2+\frac {a^2 (c+d x)^2}{2 d}-\frac {a b (c+d x)^2}{d}+\frac {2 a b (c+d x) \log \left (1+e^{2 (e+f x)}\right )}{f}+\frac {b^2 d \log (\cosh (e+f x))}{f^2}-\frac {b^2 (c+d x) \tanh (e+f x)}{f}-\frac {(2 a b d) \int \log \left (1+e^{2 (e+f x)}\right ) \, dx}{f}\\ &=b^2 c x+\frac {1}{2} b^2 d x^2+\frac {a^2 (c+d x)^2}{2 d}-\frac {a b (c+d x)^2}{d}+\frac {2 a b (c+d x) \log \left (1+e^{2 (e+f x)}\right )}{f}+\frac {b^2 d \log (\cosh (e+f x))}{f^2}-\frac {b^2 (c+d x) \tanh (e+f x)}{f}-\frac {(a b d) \text {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^{2 (e+f x)}\right )}{f^2}\\ &=b^2 c x+\frac {1}{2} b^2 d x^2+\frac {a^2 (c+d x)^2}{2 d}-\frac {a b (c+d x)^2}{d}+\frac {2 a b (c+d x) \log \left (1+e^{2 (e+f x)}\right )}{f}+\frac {b^2 d \log (\cosh (e+f x))}{f^2}+\frac {a b d \text {Li}_2\left (-e^{2 (e+f x)}\right )}{f^2}-\frac {b^2 (c+d x) \tanh (e+f x)}{f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 1.40, size = 192, normalized size = 1.51 \begin {gather*} \frac {\cosh (e+f x) \left (\cosh (e+f x) \left (-\left ((e+f x) \left (-2 a b d (e+f x)+a^2 (d e-2 c f-d f x)+b^2 (d e-2 c f-d f x)\right )\right )+4 a b d (e+f x) \log \left (1+e^{-2 (e+f x)}\right )+2 b (b d-2 a d e+2 a c f) \log (\cosh (e+f x))\right )-2 a b d \cosh (e+f x) \text {PolyLog}\left (2,-e^{-2 (e+f x)}\right )-2 b^2 f (c+d x) \sinh (e+f x)\right ) (a+b \tanh (e+f x))^2}{2 f^2 (a \cosh (e+f x)+b \sinh (e+f x))^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x)*(a + b*Tanh[e + f*x])^2,x]

[Out]

(Cosh[e + f*x]*(Cosh[e + f*x]*(-((e + f*x)*(-2*a*b*d*(e + f*x) + a^2*(d*e - 2*c*f - d*f*x) + b^2*(d*e - 2*c*f
- d*f*x))) + 4*a*b*d*(e + f*x)*Log[1 + E^(-2*(e + f*x))] + 2*b*(b*d - 2*a*d*e + 2*a*c*f)*Log[Cosh[e + f*x]]) -
 2*a*b*d*Cosh[e + f*x]*PolyLog[2, -E^(-2*(e + f*x))] - 2*b^2*f*(c + d*x)*Sinh[e + f*x])*(a + b*Tanh[e + f*x])^
2)/(2*f^2*(a*Cosh[e + f*x] + b*Sinh[e + f*x])^2)

________________________________________________________________________________________

Maple [A]
time = 2.42, size = 221, normalized size = 1.74

method result size
risch \(\frac {d \,a^{2} x^{2}}{2}-a b d \,x^{2}+\frac {b^{2} d \,x^{2}}{2}+a^{2} c x +2 a b c x +b^{2} c x +\frac {2 \left (d x +c \right ) b^{2}}{f \left (1+{\mathrm e}^{2 f x +2 e}\right )}-\frac {2 b^{2} d \ln \left ({\mathrm e}^{f x +e}\right )}{f^{2}}+\frac {b^{2} d \ln \left (1+{\mathrm e}^{2 f x +2 e}\right )}{f^{2}}+\frac {2 b a c \ln \left (1+{\mathrm e}^{2 f x +2 e}\right )}{f}-\frac {4 b a c \ln \left ({\mathrm e}^{f x +e}\right )}{f}+\frac {4 b a d e \ln \left ({\mathrm e}^{f x +e}\right )}{f^{2}}-\frac {4 b a d e x}{f}-\frac {2 b a d \,e^{2}}{f^{2}}+\frac {2 b \ln \left (1+{\mathrm e}^{2 f x +2 e}\right ) a d x}{f}+\frac {a b d \polylog \left (2, -{\mathrm e}^{2 f x +2 e}\right )}{f^{2}}\) \(221\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)*(a+b*tanh(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

1/2*d*a^2*x^2-a*b*d*x^2+1/2*b^2*d*x^2+a^2*c*x+2*a*b*c*x+b^2*c*x+2/f*(d*x+c)*b^2/(1+exp(2*f*x+2*e))-2/f^2*b^2*d
*ln(exp(f*x+e))+1/f^2*b^2*d*ln(1+exp(2*f*x+2*e))+2/f*b*a*c*ln(1+exp(2*f*x+2*e))-4/f*b*a*c*ln(exp(f*x+e))+4/f^2
*b*a*d*e*ln(exp(f*x+e))-4/f*b*a*d*e*x-2/f^2*b*a*d*e^2+2/f*b*ln(1+exp(2*f*x+2*e))*a*d*x+a*b*d*polylog(2,-exp(2*
f*x+2*e))/f^2

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*tanh(f*x+e))^2,x, algorithm="maxima")

[Out]

1/2*a^2*d*x^2 + (x^2 - 4*integrate(x/(e^(2*f*x + 2*e) + 1), x))*a*b*d + b^2*c*(x + e/f - 2/(f*(e^(-2*f*x - 2*e
) + 1))) + a^2*c*x + 1/2*b^2*d*((f*x^2 + (f*x^2*e^(2*e) - 4*x*e^(2*e))*e^(2*f*x))/(f*e^(2*f*x + 2*e) + f) + 2*
log((e^(2*f*x + 2*e) + 1)*e^(-2*e))/f^2) + 2*a*b*c*log(cosh(f*x + e))/f

________________________________________________________________________________________

Fricas [C] Result contains complex when optimal does not.
time = 0.56, size = 1326, normalized size = 10.44 \begin {gather*} \text {Too large to display} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*tanh(f*x+e))^2,x, algorithm="fricas")

[Out]

1/2*((a^2 - 2*a*b + b^2)*d*f^2*x^2 + 2*(a^2 - 2*a*b + b^2)*c*f^2*x + 4*a*b*d*cosh(1)^2 + 4*a*b*d*sinh(1)^2 + 4
*b^2*c*f + ((a^2 - 2*a*b + b^2)*d*f^2*x^2 + 4*a*b*d*cosh(1)^2 + 4*a*b*d*sinh(1)^2 - 2*(2*b^2*d*f - (a^2 - 2*a*
b + b^2)*c*f^2)*x - 4*(2*a*b*c*f + b^2*d)*cosh(1) - 4*(2*a*b*c*f - 2*a*b*d*cosh(1) + b^2*d)*sinh(1))*cosh(f*x
+ cosh(1) + sinh(1))^2 + 2*((a^2 - 2*a*b + b^2)*d*f^2*x^2 + 4*a*b*d*cosh(1)^2 + 4*a*b*d*sinh(1)^2 - 2*(2*b^2*d
*f - (a^2 - 2*a*b + b^2)*c*f^2)*x - 4*(2*a*b*c*f + b^2*d)*cosh(1) - 4*(2*a*b*c*f - 2*a*b*d*cosh(1) + b^2*d)*si
nh(1))*cosh(f*x + cosh(1) + sinh(1))*sinh(f*x + cosh(1) + sinh(1)) + ((a^2 - 2*a*b + b^2)*d*f^2*x^2 + 4*a*b*d*
cosh(1)^2 + 4*a*b*d*sinh(1)^2 - 2*(2*b^2*d*f - (a^2 - 2*a*b + b^2)*c*f^2)*x - 4*(2*a*b*c*f + b^2*d)*cosh(1) -
4*(2*a*b*c*f - 2*a*b*d*cosh(1) + b^2*d)*sinh(1))*sinh(f*x + cosh(1) + sinh(1))^2 - 4*(2*a*b*c*f + b^2*d)*cosh(
1) + 4*(a*b*d*cosh(f*x + cosh(1) + sinh(1))^2 + 2*a*b*d*cosh(f*x + cosh(1) + sinh(1))*sinh(f*x + cosh(1) + sin
h(1)) + a*b*d*sinh(f*x + cosh(1) + sinh(1))^2 + a*b*d)*dilog(I*cosh(f*x + cosh(1) + sinh(1)) + I*sinh(f*x + co
sh(1) + sinh(1))) + 4*(a*b*d*cosh(f*x + cosh(1) + sinh(1))^2 + 2*a*b*d*cosh(f*x + cosh(1) + sinh(1))*sinh(f*x
+ cosh(1) + sinh(1)) + a*b*d*sinh(f*x + cosh(1) + sinh(1))^2 + a*b*d)*dilog(-I*cosh(f*x + cosh(1) + sinh(1)) -
 I*sinh(f*x + cosh(1) + sinh(1))) + 2*(2*a*b*c*f - 2*a*b*d*cosh(1) - 2*a*b*d*sinh(1) + b^2*d + (2*a*b*c*f - 2*
a*b*d*cosh(1) - 2*a*b*d*sinh(1) + b^2*d)*cosh(f*x + cosh(1) + sinh(1))^2 + 2*(2*a*b*c*f - 2*a*b*d*cosh(1) - 2*
a*b*d*sinh(1) + b^2*d)*cosh(f*x + cosh(1) + sinh(1))*sinh(f*x + cosh(1) + sinh(1)) + (2*a*b*c*f - 2*a*b*d*cosh
(1) - 2*a*b*d*sinh(1) + b^2*d)*sinh(f*x + cosh(1) + sinh(1))^2)*log(cosh(f*x + cosh(1) + sinh(1)) + sinh(f*x +
 cosh(1) + sinh(1)) + I) + 2*(2*a*b*c*f - 2*a*b*d*cosh(1) - 2*a*b*d*sinh(1) + b^2*d + (2*a*b*c*f - 2*a*b*d*cos
h(1) - 2*a*b*d*sinh(1) + b^2*d)*cosh(f*x + cosh(1) + sinh(1))^2 + 2*(2*a*b*c*f - 2*a*b*d*cosh(1) - 2*a*b*d*sin
h(1) + b^2*d)*cosh(f*x + cosh(1) + sinh(1))*sinh(f*x + cosh(1) + sinh(1)) + (2*a*b*c*f - 2*a*b*d*cosh(1) - 2*a
*b*d*sinh(1) + b^2*d)*sinh(f*x + cosh(1) + sinh(1))^2)*log(cosh(f*x + cosh(1) + sinh(1)) + sinh(f*x + cosh(1)
+ sinh(1)) - I) + 4*(a*b*d*f*x + a*b*d*cosh(1) + a*b*d*sinh(1) + (a*b*d*f*x + a*b*d*cosh(1) + a*b*d*sinh(1))*c
osh(f*x + cosh(1) + sinh(1))^2 + 2*(a*b*d*f*x + a*b*d*cosh(1) + a*b*d*sinh(1))*cosh(f*x + cosh(1) + sinh(1))*s
inh(f*x + cosh(1) + sinh(1)) + (a*b*d*f*x + a*b*d*cosh(1) + a*b*d*sinh(1))*sinh(f*x + cosh(1) + sinh(1))^2)*lo
g(I*cosh(f*x + cosh(1) + sinh(1)) + I*sinh(f*x + cosh(1) + sinh(1)) + 1) + 4*(a*b*d*f*x + a*b*d*cosh(1) + a*b*
d*sinh(1) + (a*b*d*f*x + a*b*d*cosh(1) + a*b*d*sinh(1))*cosh(f*x + cosh(1) + sinh(1))^2 + 2*(a*b*d*f*x + a*b*d
*cosh(1) + a*b*d*sinh(1))*cosh(f*x + cosh(1) + sinh(1))*sinh(f*x + cosh(1) + sinh(1)) + (a*b*d*f*x + a*b*d*cos
h(1) + a*b*d*sinh(1))*sinh(f*x + cosh(1) + sinh(1))^2)*log(-I*cosh(f*x + cosh(1) + sinh(1)) - I*sinh(f*x + cos
h(1) + sinh(1)) + 1) - 4*(2*a*b*c*f - 2*a*b*d*cosh(1) + b^2*d)*sinh(1))/(f^2*cosh(f*x + cosh(1) + sinh(1))^2 +
 2*f^2*cosh(f*x + cosh(1) + sinh(1))*sinh(f*x + cosh(1) + sinh(1)) + f^2*sinh(f*x + cosh(1) + sinh(1))^2 + f^2
)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tanh {\left (e + f x \right )}\right )^{2} \left (c + d x\right )\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*tanh(f*x+e))**2,x)

[Out]

Integral((a + b*tanh(e + f*x))**2*(c + d*x), x)

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*tanh(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((d*x + c)*(b*tanh(f*x + e) + a)^2, x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (a+b\,\mathrm {tanh}\left (e+f\,x\right )\right )}^2\,\left (c+d\,x\right ) \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*tanh(e + f*x))^2*(c + d*x),x)

[Out]

int((a + b*tanh(e + f*x))^2*(c + d*x), x)

________________________________________________________________________________________